package com.firefly.dao.assembler.mc;

import com.firefly.dao.dao.mc.po.McMenuPo;
import com.firefly.dao.dao.mc.po.McRolePermissionPo;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @description:
 * @author: lzg(萤火科技 ： 854378082 @ qq.com)
 * @date: 2023/1/31
 **/
@Component
public class McRolePermissionAssembler {
    public List<McRolePermissionPo> getListPo(int roleId, List<McMenuPo> all){
        List<McRolePermissionPo> listPo = new ArrayList<>();
        for (McMenuPo menu : all) {
            McRolePermissionPo tmp = new McRolePermissionPo();
            tmp.setRoleId(roleId);
            tmp.setMenuId(menu.getId());
            tmp.setName(menu.getName());
            tmp.setUrl(menu.getUrl());
            listPo.add(tmp);
        }
        return listPo;
    }
}
